import {ref, watch, defineEmits} from 'vue';

export const useVModel = (props: any, key: string = 'modelValue') => {
  const value = ref(props[key]);
  const emits = defineEmits(['update:modelValue']);
  watch(value, () => {
    emits('update:modelValue', value.value);
  });
  return value;
};
